package com.quanling.swing.moju;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static java.util.regex.Pattern.compile;

public class RegexMatches {
	
	public static void main(String args[]) {
//		String str = "[NR_VER(15)] = 3.9 (MAIN RELEASE)";
//		String pattern = "^\\[NR_VER\\(\\d+\\)].*";
//
//		Pattern r = Pattern.compile(pattern);
//		Matcher m = r.matcher(str);
//		System.out.println(m.matches());

//		String strTest = "(ENDEPPANFAHREN)";
//		String testPattern = "^[\\(|（][\\S|\\s]+[\\)|）]";
//        Pattern rTest = Pattern.compile(testPattern);
//        Matcher mTest = rTest.matcher(strTest);
//        System.out.println(mTest.matches());

//        String subStr = "G52Y200.00000000Z0";
//        String reg = "\\d+(\\.\\d*)?";
//        Pattern pattern = Pattern.compile(reg);
//        String tempSub = subStr.substring(0, subStr.indexOf("G52") + 4);
//        String endStr = subStr.substring(subStr.lastIndexOf("Z0"));
//        subStr = tempSub + "0" + endStr;
//        Matcher matcher = pattern.matcher(endStr);
//        if(matcher.matches()) {
//            System.out.println(matcher.group());
//        }
//
//        System.out.println(tempSub + "\nreplace:" + endStr);
//        System.out.println("result:" + subStr);

//        String subStr = "#31:=85.37983132#32:=75.54105381#30:=-49.67641203#35:=-45.89688940G58G94G00;";
//        String sub1 = subStr.substring(subStr.indexOf("#31"), subStr.indexOf("#32"));
//        String sub2 = subStr.substring(subStr.indexOf("#32"), subStr.indexOf("#30"));
//        String sub3 = subStr.substring(subStr.indexOf("#30"), subStr.indexOf("#35"));
//        String sub4 = subStr.substring(subStr.indexOf("#35"), subStr.indexOf("G58G94G00;"));
//        String sub5 = subStr.substring(subStr.indexOf("G58G94G00"));

//        System.out.println(sub1);
//        System.out.println(sub2);
//        System.out.println(sub3);
//        System.out.println(sub4);
//        System.out.println(sub5);

        String testStr = "A177.26149769";
        String testStr2 = "A-70.78209400";
        System.out.println(testStr2.substring(testStr2.indexOf(".") + 1));

        Pattern patternA = compile("A(-*)\\d+(\\.\\d*)");
        Matcher matcher = patternA.matcher(testStr2);
        if(matcher.find()) {
            System.out.println(matcher.group());
        }


	}

}